package art_of_java_concurrent_programming.lock.shared;

/**
 * @author lixiangke
 * @date 2018/1/28
 */
public class SemaphoreTest {
    public static void main(String[] args) throws InterruptedException {
        Zoom zoom = new Zoom();
        Thread t1 = new Thread() {
            @Override
            public void run() {
                try {
                    zoom.visit();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t2 = new Thread() {
            @Override
            public void run() {
                try {
                    zoom.visit();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t3 = new Thread() {
            @Override
            public void run() {
                try {
                    zoom.visit();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t4 = new Thread() {
            @Override
            public void run() {
                try {
                    zoom.visit();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}
